<?php


namespace app\common\model;


class VerificationLog extends Base
{
    protected $table = "maniac_verification_log";
    protected $createTime = "created_at";
    protected $updateTime = "updated_at";
    public $autoWriteTimestamp = "datetime";
    //获取核销名称
    public function getVerificationNameAttr($value,$data){
        return Verification::withTrashed()->field('id,verification_name')->get($data['verification_id'])['verification_name'];
    }
    //获取核销员用户昵称
    public function getVerificationNicknameAttr($value,$data){
        return Members::field('id,nickname')->get($data['member_id'])['nickname'];
    }
    //获取商品信息
    public function getGoodsInfoAttr($value,$data){
        return OrderGoods::field('goods_name,sku_name')->get($data['order_goods_id']);
    }
    //获取核销人员
    public function getStaffNameAttr($value,$data){
        return MemberQy::where("id",$data['staff_id'])->value('name');
    }
    //优惠券名称
    public function getCouponNameAttr($value,$data){
        return Coupon::where("id",$data['coupon_id'])->value('coupon_name');
    }
    //获取用户名
    public function getMemberNameAttr($value,$data){
        return Members::where("id",$data['member_id'])->value('nickname');
    }
}